import java.io.PrintStream;
import java.util.Scanner;

/**
 * 10642 - Can You Solve It?
 * @author jjeske
 * Status: accepted!
 *
 */
public class Main {
	public static void main(String[] args){
		Main canYou = new Main();
		canYou.begin();
	}

	/*
	 * Sample Input

3
0 0 0 1
0 0 1 0
0 0 0 2

Sample Output

Case 1: 1
Case 2: 2
Case 3: 3
	 */
	private void begin() {
		Scanner entrada = new Scanner(System.in);
		PrintStream saida = new PrintStream(System.out);
		int cases = entrada.nextInt();
		final int totalCases = cases+1; 
		long x1,y1,x2,y2; //valores de entrada!
		while(cases != 0){
			x1 = entrada.nextLong();
			y1 = entrada.nextLong();
			x2 = entrada.nextLong();
			y2 = entrada.nextLong();			
			saida.printf("Case %d: %d\n", totalCases - cases, resolve(x1,y1,x2,y2));
			cases--;
		}		
	}
	/*
	 * essa classe resolve o problema
	 */
	private static long resolve(long x1, long y1, long x2, long y2) {
		long level1 = x1 + y1; //level == nivel, eh o nivel no grid
		long level2 = x2 + y2;
		
		if(level1 == level2){
			//aqui a entrada e o destino estao no mesmo nivel
			return y1 - y2;
		} else {
			//retorna de acordo com o calcula de diferencas
			return y1 + x2 + (level2-level1) + somaCumulativa(level1+1, level2-1); 
		}		
	}
	
	/*
	 * soma todos os numeros entre a e b inclusive	
	 */
	private static long somaCumulativa(long a, long b){
		if(a > b){
			return 0;
		} else {
			long acumulador = 0;
			for(long l = a; l<=b; l++){
				acumulador = acumulador + l;
			}
			return acumulador;
		}
		
	}
}